#include "StdAfx.h"
#include "WatchGraph.h"


CWatchGraph::CWatchGraph(void)
{
}


CWatchGraph::~CWatchGraph(void)
{
}

bool CWatchGraph::CreateCaptureShow(HWND hwnd,int place )
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	HRESULT hr = NOERROR;
	hr = pGraph->QueryInterface(IID_IVideoWindow, (void **) &pWindow);
	RETURN_IF_FAILED(hr);
	if(SUCCEEDED(hr))
	{
		//RECT rc;
		hr=pWindow->put_Owner((OAHWND)hwnd);
		RECT rect;
		::GetWindowRect(hwnd,&rect);
		// Use helper function to position video window in client rect 
		// of main application window
		pWindow->SetWindowPosition(0, 0, rect.right, rect.bottom);
		hr=pWindow->put_Visible(OATRUE);
		hr=pWindow->put_WindowStyle(WS_CHILD|WS_CLIPSIBLINGS);
	}
	return TRUE;
}

void CWatchGraph::ResetView(HWND hwnd)
{
	if(pWindow == NULL)
	{
		return;
	}
	RECT rect;
	::GetWindowRect(hwnd,&rect);
	// Use helper function to position video window in client rect 
	// of main application window
	pWindow->SetWindowPosition(0, 0, rect.right, rect.bottom);
}